//
//  CreateAdvertisingViewDescriptionCell.swift
//  iModern
//
//  Created by Ralf on 7/31/15.
//  Copyright (c) 2015 com.starlooking. All rights reserved.
//

import UIKit

class CreateAdvertisingViewDescriptionCell: UITableViewCell, UITextViewDelegate
{
    var attchment: NSMutableDictionary!

    @IBOutlet weak var textView: UITextView!
    override func awakeFromNib()
    {
        super.awakeFromNib()

        textView.delegate = self
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool)
    {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    func textViewDidEndEditing(textView: UITextView)
    {
        attchment["description"] = textView.text
    }

    func setData(data: NSMutableDictionary)
    {
        attchment = data

        textView.layer.borderWidth=1
        textView.layer.borderColor=UIColor.grayColor().CGColor
        
        let description = attchment["description"] as? String

        if description == nil
        {
            textView.text = "描述"
        }
        else
        {
            textView.text = description
        }
    }
}
